home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue66 / Construc / Refactor / Source / fIncrement.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-10-04  |  1.8 KB  |  68 lines

  1. unit fIncrement;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Buttons;
  8.  
  9. type
  10.   Tf_Increment = class(TForm)
  11.     e_fileBuild: TEdit;
  12.     E_ProductBuild: TEdit;
  13.     e_comment: TEdit;
  14.     L_FileBuild: TLabel;
  15.     L_ProductBuild: TLabel;
  16.     Label1: TLabel;
  17.     BitBtn1: TBitBtn;
  18.     procedure e_fileBuildKeyPress(Sender: TObject; var Key: Char);
  19.   private
  20.     fFileBuild, fProductBuild : integer;
  21.     fComment : string;
  22.   public
  23.   end;
  24.  
  25.   Procedure SetIncrement(var aFileBuild, aProductBuild : integer; var aComment : string);
  26.  
  27. implementation
  28. {$R *.DFM}
  29. { Tf_Increment }
  30.  
  31. var
  32.  f_increment : tf_increment;
  33.  
  34. Procedure SetIncrement(var aFileBuild,
  35.   aProductBuild: integer; var aComment: string);
  36. begin
  37.   f_increment := tf_increment.create(nil);
  38.   try
  39.     with f_increment do begin
  40.       L_FileBuild.caption := 'File Build # '+IntToStr(aFileBuild)+' will increment to: ';
  41.       Inc(aFileBuild);
  42.       e_FileBuild.text := InttoStr(aFileBuild);
  43.       L_ProductBuild.caption := 'Product Build # '+IntToStr(aProductBuild)+' will increment to: ';
  44.       Inc(aProductBuild);
  45.       e_ProductBuild.text := InttoStr(aProductBuild);
  46.       e_comment.text := aComment;
  47.       Showmodal;
  48.       if trim(e_fileBuild.text) = ''
  49.         then e_fileBuild.text := '0';
  50.       aFileBuild := StrtoInt(e_fileBuild.text);
  51.       if trim(e_ProductBuild.text) = ''
  52.         then e_ProductBuild.text := '0';
  53.       aProductBuild := StrtoInt(e_ProductBuild.text);
  54.       aComment := e_comment.text;
  55.       end;
  56.   finally
  57.     f_increment.free;
  58.   end;
  59. end;
  60.  
  61. procedure Tf_Increment.e_fileBuildKeyPress(Sender: TObject; var Key: Char);
  62. begin
  63.   if not (key in ['0'..'9', #27, #8, #9, #13])
  64.     then key := #0;
  65. end;
  66.  
  67. end.
  68.